GDK W32: Support switching IM contexts at runtime
authorРуслан Ижбулатов <lrn1986@gmail.com>
Tue, 2 Oct 2018 09:34:22 +0000 (09:34 +0000)
committerРуслан Ижбулатов <lrn1986@gmail.com>
Sat, 6 Oct 2018 17:45:30 +0000 (17:45 +0000)
commit66c0336ead9fd27cb93354336d113e8855406b22
tree374481e79dc0a24d79300b4db22aea4974ea127e
parent0657a539404c2fc00c56211c935fdba9a01b4fe2
GDK W32: Support switching IM contexts at runtime

This leverages the normal input context switching mechanism in GTK
by making it think that the gtk-im-module setting changed.
The backend returns gtk-im-module value as "ime" if W32
IME API says that an IME is in use. Otherwise it returns
and empty string - this still triggers an input context
switching code, which, not being able to create the desired context
(which is and empty string), falls back to looking at current
keyboard layout (currently that code is still a FIXME).

Paired with the code that signals gtk-im-module change on keyboard layout
switches, this is sufficient to make GTK capable of switching to
the appropriate IM context at runtime. At least, the kinds of context
that specify languages for which they are used automatically by default
(once locale matching is implemented), and the IME context.

Loading other kinds of IM context might still work via specifying
the gtk-im-module setting in gtk ini file, but doing so will likely
make GTK incapable of using the IME context that is used
for Korean, Chinese and Japanese (and some other languages).

Until someone figures out a way to actually change gtk-im-module
setting on Windows at runtime with meaningful values, the behaviour
introduced by this commit seems like a sufficient workaround.
gdk/win32/gdkevents-win32.c
gdk/win32/gdkproperty-win32.c